Remove needless dylib check, add test
authorSean Griffin <sean@seantheprogrammer.com>
Sat, 19 Dec 2015 19:44:34 +0000 (12:44 -0700)
committerSean Griffin <sean@seantheprogrammer.com>
Sat, 19 Dec 2015 19:44:34 +0000 (12:44 -0700)
In this case the dylib check isn't actually doing anything useful, as
we're just appending search paths. Also adds a test for
8c65284b44337c6cfc003cedc8996e241ac678bd

src/cargo/ops/cargo_rustc/mod.rs
tests/test_cargo_compile_custom_build.rs

index 434faa20bad7d172aef1fc1377085d4d539b2312..17bd3647219275928ec6061b000174ea9e042d67 100644 (file)
@@ -159,12 +159,6 @@ pub fn compile_targets<'a, 'cfg: 'a>(pkg_targets: &'a PackagesToBuild<'a>,
         if pkg == root_pkg {
             cx.compilation.cfgs.extend(output.cfgs.iter().cloned());
         }
-        let any_dylib = output.library_links.iter().any(|l| {
-            !l.starts_with("static=") && !l.starts_with("framework=")
-        });
-        if !any_dylib && !output.library_links.is_empty() {
-            continue
-        }
         for dir in output.library_paths.iter() {
             cx.compilation.native_dirs.insert(pkg.clone(), dir.clone());
         }
index 587185b4cfef8e0a94a96968c15570d9922750b8..8c7357436ff23243e9d51f47dc7887a2e0bc5ab8 100644 (file)
@@ -1789,3 +1789,36 @@ test!(rebuild_only_on_explicit_paths {
 ", running = RUNNING, compiling = COMPILING)));
 });
 
+
+test!(doctest_recieves_build_link_args {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.5.0"
+            authors = []
+            [dependencies.a]
+            path = "a"
+        "#)
+        .file("src/lib.rs", "")
+        .file("a/Cargo.toml", r#"
+            [project]
+            name = "a"
+            version = "0.5.0"
+            authors = []
+            links = "bar"
+            build = "build.rs"
+        "#)
+        .file("a/src/lib.rs", "")
+        .file("a/build.rs", r#"
+            fn main() {
+                println!("cargo:rustc-link-search=native=bar");
+            }
+        "#);
+
+    assert_that(p.cargo_process("test").arg("-v"),
+                execs().with_status(0)
+                       .with_stdout_contains(&format!("\
+{running} `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`
+", running = RUNNING)));
+});